import { getOrganization } from 'api/api'
const state = {
    orgList: [],
    addSubChooseInfo: {},
    editSubChooseInfo: {},
    premiumChooseInfo: {}
}

const mutations = {
    SETORGLIST: (state, orgList) => {
        state.orgList = orgList
    },
    SETADDSUBCHOOSEINFO: (state, addSubChooseInfo) => {
        state.addSubChooseInfo = addSubChooseInfo
    },
    SETEDITSUBCHOOSEINFO: (state, editSubChooseInfo) => {
        state.editSubChooseInfo = editSubChooseInfo
    },
    SETPREMIUMCHOOSEINFO: (state, premiumChooseInfo) => {
        state.premiumChooseInfo = premiumChooseInfo
    }
}

const actions = {
    getOrgList ({ commit }) {
        getOrganization()
            .then((res) => {
                commit('SETORGLIST', res.data)
            })
    }
}

export default {
    namespaced: true,
    state,
    mutations,
    actions
}
